#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
const int N = 1e3 + 10;
int n, d;
struct node
{
    double l, r;
}S[N];
bool cmp(node a, node b)
{
    return a.r < b.r;
}
int main()
{
    cin >> n >> d;
    bool flag = 0;
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        if (y > d)flag = 1;
        double len = sqrt(d * d - y * y);
        S[i] = { x - len,x + len };
    }
    if (flag)cout << "-1" << endl;
    else {
        sort(S, S + n, cmp);
        double last = -1e10;
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (S[i].l > last) {
                cnt++;
                last = S[i].r;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}